package com.bw.Controller;

import com.bw.Service.StuService;
import com.bw.bean.Str;
import com.bw.bean.Str1;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @BelongsProject: yuekao1
 * @BelongsPackage: com.bw.Controller
 * @Author: wuxiaopeng
 * @CreateTime: 2024-09-25  19:39
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
public class StuController {
    @Autowired
    StuService stuService;

    @RequestMapping("list1")
    public Map getlist(){
        List<Str> list=stuService.getlist();
        return SugarUtil.getMapData(list);
    }

    @RequestMapping("list2")
    public Map getlist1(){
        List<Str> list=stuService.getlist1();
        return SugarUtil.getBarData(list);
    }

    @RequestMapping("list3")
    public Map getlist3(){
        List<Str> list=stuService.getlist3();
        return SugarUtil.getPieData(list);
    }

    @RequestMapping("list4")
    public Map getlist4(){
        List<Str1> list=stuService.getlist4();
        List<String> list1 = new ArrayList<>();
        list1.add("类型");
        list1.add("新用户");
        list1.add("老用户");
        return SugarUtil.getTablePlayData(list1,list);
    }
}
